\doxysection{v\+Task\+Delay }
\hypertarget{group__v_task_delay}{}\label{group__v_task_delay}\index{vTaskDelay@{vTaskDelay}}
task. h 
\begin{DoxyPre}void vTaskDelay( const TickType\_t xTicksToDelay );\end{DoxyPre}


Delay a task for a given number of ticks. The actual time that the task remains blocked depends on the tick rate. The constant port\+TICK\+\_\+\+PERIOD\+\_\+\+MS can be used to calculate real time from the tick rate -\/ with the resolution of one tick period.

INCLUDE\+\_\+v\+Task\+Delay must be defined as 1 for this function to be available. See the configuration section for more information.

v\+Task\+Delay() specifies a time at which the task wishes to unblock relative to the time at which v\+Task\+Delay() is called. For example, specifying a block period of 100 ticks will cause the task to unblock 100 ticks after v\+Task\+Delay() is called. v\+Task\+Delay() does not therefore provide a good method of controlling the frequency of a periodic task as the path taken through the code, as well as other task and interrupt activity, will effect the frequency at which v\+Task\+Delay() gets called and therefore the time at which the task next executes. See v\+Task\+Delay\+Until() for an alternative API function designed to facilitate fixed frequency execution. It does this by specifying an absolute time (rather than a relative time) at which the calling task should unblock.


\begin{DoxyParams}{Parameters}
{\em x\+Ticks\+To\+Delay} & The amount of time, in tick periods, that the calling task should block.\\
\hline
\end{DoxyParams}
Example usage\+:

void v\+Task\+Function( void \texorpdfstring{$\ast$}{*} pv\+Parameters ) \{ Block for 500ms. const Tick\+Type\+\_\+t x\+Delay = 500 / port\+TICK\+\_\+\+PERIOD\+\_\+\+MS; \begin{DoxyVerb}for( ;; )
{
\end{DoxyVerb}
 Simply toggle the LED every 500ms, blocking between each toggle. v\+Toggle\+LED(); v\+Task\+Delay( x\+Delay ); \} \} 